# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# from AUR - adjusted to our styles
#
# Old Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-requirementslib
_pkgname=requirementslib
pkgver=2.3.0
pkgrel=4
pkgdesc='A tool for converting between pip-style and pipfile requirements.'
url='https://github.com/sarugaku/requirementslib'
license=('MIT')
arch=('any')
depends=('python-attrs' 'python-cached-property' 'python-distlib'
         'python-pep517' 'python-pip' 'python-platformdirs' 'python-plette'
         'python-cerberus' 'python-requests' 'python-setuptools'
         'python-tomlkit' 'python-vistir')
makedepends=('python-invoke' 'python-wheel' 'python-parver' 'git')
source=("$pkgname-$pkgver.tar.gz::https://github.com/sarugaku/requirementslib/archive/$pkgver.tar.gz"
        "git+https://github.com/kennethreitz/requests.git#commit=64bde6582d9b49e9345d9b8df16aaa26dc372d13"
        "git+https://github.com/sarugaku/shellingham.git#commit=9abe7464dab5cc362fe08361619d3fb15f2e16ab"
        "git+https://github.com/pyinstaller/pyinstaller.git#commit=6d4cce1f8eb80c0bf49d35876d28daa55a05800f")
sha512sums=('b3102d10deb37a7d0070ccf40575a35861e6713a1f12ba695c2237ad10bbf0828154c2f035cba2fcb9e341bfaf604c64c66fe5922f17a2a1fa4fc684e8b2986c'
            'SKIP'
            'SKIP'
            'SKIP')

prepare() {
  cd "$_pkgname-$pkgver/tests/artifacts/git"

  rmdir requests shellingham pyinstaller

  ln -s "$srcdir"/requests
  ln -s "$srcdir"/shellingham
  ln -s "$srcdir"/pyinstaller
}

build() {
  cd "$_pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}

